import{AxiosHeaders as e,AxiosError as s}from"axios";import o from"../../node_modules/.pnpm/axios@1.13.2/node_modules/axios/lib/core/settle.mjs";import{resolveUniAppRequestOptions as t}from"../utils/index.mjs";import r from"./onCanceled.mjs";const i=i=>new Promise((n,a)=>{const d=t(i),l=i;l.headers=new e(d.header);const u=new r(i);let c=uni.uploadFile({...d,success(e){if(!c)return;const s={config:l,data:e.data,headers:{},status:e.statusCode,statusText:e.errMsg??"OK",request:c};o(n,a,s),c=null},fail(e){const{errMsg:o=""}=e??{};if(o){const e="uploadFile:fail file error"===o;"uploadFile:fail timeout"===o&&a(new s(o,s.ETIMEDOUT,l,c)),e&&a(new s(o,s.ERR_NETWORK,l,c))}a(new s(e.errMsg,void 0,l,c)),c=null},complete(){u.unsubscribe()}});"function"==typeof i.onHeadersReceived&&c.onHeadersReceived(i.onHeadersReceived),u.subscribe(c,a)});export{i as default};
//# sourceMappingURL=upload.mjs.map
